package interfaceCusService;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTable;
import javax.swing.JTextArea;
import javax.swing.JTextField;

public class AnswerComplaintPanel extends JPanel implements ActionListener{
	private JTextField txtCusId;
	private JTextField txtCusName;
	private JTextField txtCarId,txtAmount;
	private JTextArea txtDesc,txtAnswer;
	private JLabel lblCusId,lblrefund,lblsign;
	private JLabel lblCusName;
	private JLabel lblCarId;
	private JLabel lblDesc,lblAnswer;
	private JButton btnComment;
	private JButton btnCreditCustomer;
	private JButton btnCharge;
	private JButton btnMainMenu;
	private Dimension wfs;
	private CusServiceFrame csfg;
	private ComplaintTable ct;
	
	
	public AnswerComplaintPanel(Dimension fz, CusServiceFrame wfg,String[] d,ComplaintTable ct1) {
		
		wfs=fz;
		csfg=wfg;
		ct=ct1;
		
		//setTitle("Answer Complaint");
		this.setSize(fz);
		this.setLayout(null);
		//this.setLocationRelativeTo(null);
		
		lblCusId = new JLabel("Customer ID:");
		lblCusId.setBounds(10, 7, 75, 20);
		
		lblrefund = new JLabel("Refund:");
		lblrefund.setBounds(10, 350, 75, 20);
		
		lblsign = new JLabel("$");
		lblsign.setBounds(130, 350, 75, 20);
		
		txtCusId = new JTextField(d[1]);
		txtCusId.setBounds(88, 7, 75, 20);
		txtCusId.setEditable(false);
		
		lblCusName = new JLabel("Customer Name:");
		lblCusName.setBounds(167, 10, 100, 14);
		
		txtCusName = new JTextField(d[0]);
		txtCusName.setBounds(269, 7, 75, 20);
		txtCusName.setEditable(false);
		
		txtAmount = new JTextField();
		txtAmount.setBounds(50, 350, 75, 20);
		
		lblCarId = new JLabel("Car ID:");
		lblCarId.setBounds(348, 10, 45, 14);
		
		txtCarId = new JTextField(d[2]);
		txtCarId.setBounds(392, 7, 75, 20);
		txtCarId.setEditable(false);
		
		txtDesc = new JTextArea("Customer Complaint");
		txtDesc.setBounds(88, 63, 380, 123);
		txtDesc.setEditable(false);
		
		txtAnswer = new JTextArea();
		txtAnswer.setBounds(88, 200, 380, 123);
		
		lblDesc = new JLabel("Description:");
		lblDesc.setBounds(10, 63, 75, 20);
		
		lblAnswer = new JLabel("Answer:");
		lblAnswer.setBounds(10, 197, 75, 20);
		
		
		btnComment = new JButton("Send");
		btnComment.setBounds(379, 400, 89, 23);
		btnComment.addActionListener((ActionListener) this);
		
		/*btnCreditCustomer = new JButton("Credit");
		btnCreditCustomer.setBounds(280, 205, 89, 23);
		btnCreditCustomer.addActionListener(this);
		
		
		btnCharge = new JButton("Charge");
		btnCharge.addActionListener(this);
		btnCharge.setBounds(181, 205, 89, 23);*/
		
		
		btnMainMenu = new JButton("Close");
		btnMainMenu.setBounds(98, 400, 95, 23);
		btnMainMenu.addActionListener(this);
		
		add(lblrefund);
		add(lblsign);
		add(txtAmount);
		add(btnComment);
		add(lblDesc);
		add(txtDesc);
		add(lblCusId);
		add(txtCusId);
		add(lblCusName);
		add(txtCusName);
		add(lblCarId);
		add(txtCarId);
		add(txtAnswer);
		add(lblAnswer);
		//add(btnCreditCustomer);
		add(btnMainMenu);
		//add(btnCharge);
		
		//this.setDefaultCloseOperation(EXIT_ON_CLOSE);
		this.setVisible(true);
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		// TODO Auto-generated method stub
		if(e.getSource()== btnComment)
		{
			//this.setVisible(false);
			
			
			this.removeAll();
			csfg.setContentPane(ct);
			validate();
			repaint();
			ct.removerRow();
		}
		
		if(e.getSource() == btnMainMenu)
			this.removeAll();
			csfg.setContentPane(ct);
			validate();
			repaint();
		
		
		
	}

	
}